// Copyright (c) 2007 Gerhardt Informatics Kft. All rights reserved.
package com.gerhardtinformatics.rcprobot;

/**
 * @author Frank Gerhardt
 */
public interface IRCPRobot {

	/**
	 * Asserts the name of the active Perspective.
	 *  
	 * @param name the name of the active Perspective
	 */
	void assertActivePerspective(String name);

	/**
	 * Asserts the specified menu item is checked.
	 *  
	 * @param path the path of the menu
	 */
	void assertMenuItemChecked(String path);

	/**
	 * Asserts the specified menu item is disabled.
	 *  
	 * @param path the path of the menu
	 */
	void assertMenuItemDisabled(String path);

	/**
	 * Asserts the MenuItem is enabled. The path like 'File/Save'. The real path
	 * is like '&File/&Save Ctrl+S' but it removes the 'short cuts'.
	 * 
	 * @param path
	 *            the path of the MenuItem
	 */
	void assertMenuItemEnabled(String path);

	/**
	 * Asserts the specified menu item exists.
	 *  
	 * @param path the path of the menu
	 */
	void assertMenuItemExists(String path);

	/**
	 * Asserts the specified menu item is not checked.
	 *  
	 * @param path the path of the menu
	 */
	void assertMenuItemNotChecked(String path);

	/**
	 * Asserts the specified node exists in the view.
	 *  
	 * @param viewName the name of the view
	 * @param treePath the path of the node
	 */
	void assertNodeExistsInView(String viewName, String treePath);

	/**
	 * Asserts the specified node doesn't exist in the view.
	 *  
	 * @param viewName the name of the view
	 * @param treePath the path of the node
	 */
	void assertNodeNotExistsInView(String viewName, String treePath);

	/**
	 * Asserts the specified ToolBarAction is disabled.
	 *  
	 * @param toolTipText the tool tip text of the ToolBarAction
	 */
	void assertToolBarActionDisabled(String toolTipText);

	/**
	 * Asserts the specified ToolBarAction is enabled.
	 *  
	 * @param toolTipText the tool tip text of the ToolBarAction
	 */
	void assertToolBarActionEnabled(String toolTipText);

	/**
	 * Asserts the specified ToolBarAction exists.
	 *  
	 * @param toolTipText the tool tip text of the ToolBarAction
	 */
	void assertToolBarActionExists(String toolTipText);

	/**
	 * Asserts the specified ToolBarAction doesn't exist.
	 *  
	 * @param toolTipText the tool tip text of the ToolBarAction
	 */
	void assertToolBarActionNotExists(String toolTipText);

	/**
	 * Asserts the specified dropdown ToolBarAction is disabled.
	 *  
	 * @param text the text of the ToolBarAction
	 */
	void assertToolBarDropDownActionDisabled(String text);

	/**
	 * Asserts the specified dropdown ToolBarAction is enabled.
	 *  
	 * @param text the text of the ToolBarAction
	 */
	void assertToolBarDropDownActionEnabled(String text);

	/**
	 * Asserts the action exists in the dropdown menu on the ToolBar. I can't
	 * use path because the text of the ToolBar button is not fix, depends on
	 * last selected action.
	 * 
	 * @param text
	 *            name of the action
	 */
	void assertToolBarDropDownActionExists(String text);

	/**
	 * Asserts the action doesn't exist in the dropdown menu on the ToolBar. I can't
	 * use path because the text of the ToolBar button is not fix, depends on
	 * last selected action.
	 * 
	 * @param text
	 *            name of the action
	 */
	void assertToolBarDropDownActionNotExists(String text);

	/**
	 * Asserts the specified view exists.
	 *  
	 * @param viewName the name of the view
	 */
	void assertViewExists(String viewName);

	/**
	 * Asserts the specified view doesn't exist.
	 *  
	 * @param viewName the name of the view
	 */
	void assertViewNotExists(String viewName);

	/**
	 * @param title
	 */
	void assertWindowTitle(String title);

	/**
	 * Clicks on the specified button.
	 * 
	 * @param buttonText the text of the button
	 */
	void clickButton(String buttonText);

	/**
	 * TODO check the doc
	 * TODO example: rcpRobot.clickButtonInEditor("Add...",
	 * "RCPMail/Dependencies/Required Plug-ins");
	 * 
	 * @param button the name of the button
	 * @param path the button
	 */
	void clickButtonInEditor(String button, String path);

	/** 
	 * Click the Label with the text "labelText", use in form editor sections.
	 * 
	 * @param labelText the text of the Label
	 */
	void clickLabel(String labelText);

	/**
	 * Opens the context menu of a tree item and clicks on the menu item.
	 * 
	 * @param viewName the name of the view
	 * @param treeItemPath the path of the tree item
	 * @param menuPath the path of the menu item
	 */
	void clickPopUpTree(String viewName, String treeItemPath, String menuPath);

	/**
	 * Clicks on the specified tab.
	 * 
	 * @param tabText the name of the tab
	 */
	void clickTab(String tabText);

	/**
	 * Closes the specified view.
	 * 
	 * @param viewName the name of the view
	 */
	void closeView(String viewName);

	/**
	 * Closes the Welcome view.
	 */
	void closeWelcomeView();

	/**
	 * Delays the specified milliseconds.
	 * 
	 * @param ms the number of milliseconds to delay
	 */
	void delay(int ms);

	/**
	 * Double clicks on the specified item in a view.
	 * 
	 * @param viewName the name of the view
	 * @param path the path of the item in the tree
	 */
	void doubleClickTree(String viewName, String path);

	/**
	 * @param c
	 *            a char
	 */
	void enterCharacter(char c);

	/**
	 * Enters the string as one char after the other.
	 * 
	 * @param string
	 *            e.g.: Enter
	 */
	void enterCharacters(String string);

	/**
	 * Pushes and releases the given key combination. <br>
	 * The first key must be a special key the second one can be a special or a
	 * normal key.
	 * 
	 * @param accelerator
	 *            e.g.: Shift+Enter or Control+s
	 */
	void enterKeyCombination(String accelerator);

	/**
	 * Pushes and releases the given key. Can be upper or lower case.
	 * 
	 * @param accelerator
	 *            e.g.: Enter, UP, up
	 */
	void enterSpecialKey(String accelerator);

	/**
	 * Pushes and releases the given key the given times.
	 * 
	 * @param accelerator
	 *            e.g.: UP
	 * @param times
	 *            the number of the key press and release
	 */
	void enterSpecialKey(String accelerator, int times);

	/**
	 * Enters the given string in one step.
	 * 
	 * @param string the String to enter
	 */
	void enterString(String string);

	/**
	 * Holds down the given key or combination of keys.
	 * 
	 * @param accelerator
	 *            e.g.: Alt+Shift
	 */
	void holdKey(String accelerator);

	/**
	 * Opens the Perspective with name. Tries with ' (default)' postfix also. If
	 * not found than puts the list of the Perspectives into the
	 * PerspectiveNotFoundException.
	 * 
	 * @param name
	 *            the name of the Perspective
	 */
	void openPerspective(String name);

	/**
	 * Opens the View with path. The path is like in "Show View" dialog: 'Java/Javadoc'
	 * 
	 * @param path
	 *            the path of the View
	 */
	void openView(String path);

	/**
	 * Releases the given key.
	 * 
	 * @param accelerator
	 *            e.g.: Shift
	 */
	void releaseKey(String accelerator);

	/**
	 * Selects a context menu item in the specified view. 
	 * 
	 * @param viewName the name of the view
	 * @param path the path of the menu item
	 */
	void selectContextMenuInView(String viewName, String path);

	/**
	 * Selects the specified menu item.
	 * @param path the path of the menu item
	 */
	void selectMenuItem(String path);

	/**
	 * Selects the menu item of the specified node's context menu in a view.
	 * 
	 * @param viewName the name of the view
	 * @param treePath the path of the item in the tree
	 * @param menuPath the path of the menu item in the context menu
	 */
	void selectNodeContextMenuInView(String viewName, String treePath, String menuPath);

	/**
	 * Selects the specified node in a view.
	 * 
	 * @param viewName the name of the view
	 * @param path the path of the node
	 */
	void selectNodeInView(String viewName, String path);

	/**
	 * The path separator is "/".
	 * 
	 * @param path
	 *            e.g.: "editorName/pageName"
	 */
	void selectPageInEditor(String path);

	/**
	 * Selects the ToolBarAction (a button on the ToolBar). Uses the ToolTipText
	 * to find the button because the text is usually empty.
	 * 
	 * @param toolTipText
	 *            the ToolTipText of the button
	 */
	void selectToolBarAction(String toolTipText);

	/**
	 * Selects the dropdown ToolBarAction (a button on the ToolBar). Uses the ToolTipText
	 * to find the button because the text is usually empty.
	 * 
	 * @param text
	 *            the text of the button
	 */
	void selectToolBarDropDownAction(String text);

	/**
	 * Sets the focus on the specified editor.
	 * 
	 * @param editorName the name of the editor
	 */
	void setFocusOnEditor(String editorName);

	/**
	 * Sets the focus on a View.
	 * 
	 * @param viewName
	 *            the name of the view
	 */
	void setFocusOnView(String viewName);

	/**
	 * Waits for Shell showing.
	 * If not found on time than throws a ShellNameNotFoundException RuntimeException.
	 * 
	 * @param title the title of the Shell
	 */
	void waitForShellShowing(String title);

	/**
	 * Waits for Shell showing.
	 * If not found on time than throws a ShellNameNotFoundException RuntimeException.
	 * 
	 * @param title the title of the Shell
	 * @param timeout the number of milliseconds to wait
	 */
	void waitForShellShowing(String title, long timeout);

}
